let fs = require("fs");
// let fd = fs.openSync("./demo1.txt","w");
// console.log(fd);
// fs.writeFileSync(fd,"哈哈哈");
// fs.closeSync(fd);
function CreateFile(num) {
    if (num != null && num > 0) {
        for (var i = 1; i <= num; i++) {
            let str = "ABCDEFGHIZKLMNOPQRSTUVWXYZabcdefghizklmnopqrstuvwxyz";
            let char = str.charAt(Math.random() * str.length);
            let fd = fs.openSync(`${__dirname}/demo${i}.txt`, "w");
            fs.writeFileSync(fd, char)
            fs.closeSync(fd);
        }
    }else{
        throw new Error("请重新输入")
    }

}
module.exports = {
    CreateFile:CreateFile
}